package com.wind.wx;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.wind.util.HttpClientUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName WXAppletUserInfo
 * @Description Hey, it's compiled! Pack it!
 * @Author Administrator
 * @Date 2021/5/30 12:31
 * @Version 1.0
 */
public class WXAppletUserInfo {

    public static JSONObject putSmallRoutine(String code){
        String url = "https://api.weixin.qq.com/sns/jscode2session";
        Map<String, String> param = new HashMap<>();
        param.put("appid", WeiXinConfig.JSAPI_ID);
        param.put("secret", WeiXinConfig.JSAPI_KEY);
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");
        JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doPost(url, param));
        return jsonObject;
    }
}
